﻿Public Class ReportUT608
    Inherits System.Web.UI.Page

    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        If Not Page.IsPostBack Then
            BL.Report.SetMonthList(Me.ddlMonth)
            BL.Report.SetYearList(Me.ddlYear)
        End If
    End Sub

    Protected Sub btnExport_Click(ByVal sender As Object, ByVal e As EventArgs) Handles btnExport.Click     'Me.ClientScript.RegisterClientScriptBlock(Me.GetType, "ut508", "window.open('report/exportpdf.aspx?rptname=ut508', 'exportpdf','')", True)
        Try
            Response.ClearContent()
            Response.ClearHeaders()
            If BL.Bank.ExportReportSmart_608(Me.ddlMonth.SelectedValue, Me.ddlYear.SelectedValue, Server.MapPath("~/report/UT604.rpt"), Server.MapPath("~/download/"), Response.OutputStream, Me.incomeFrom.Text, Me.incomeTo.Text) Then
                Response.Buffer = True
                Response.AddHeader("Content-Disposition", "inline; filename=iCashSmart.zip")
                Response.ContentType = "application/zip"
                Response.Flush()
                Response.Close()
            Else
                Me.Master.Alert("ไม่พบข้อมูล")
            End If
        Catch ex As Exception
            Common.LogError.AddLogException(ex)
            Me.Master.Alert("ไม่สามารถ Export ไฟล์ได้ อาจเกิดจากไม่พบข้อมูลหรือเกิดข้อผิดพลาดในการทำงาน")
        End Try
    End Sub
End Class